# coding=utf-8
import xadmin

from models import *

'''
故障记录
'''


class NetworkAccessAdmin(object):
    list_display = (
        'bumen', 'name', 'erp', 'mail', 'telphone', 'weizhi', 'hostname', 'usetime', 'dqtime', 'description')
    list_display_links = ('bumen')

    list_filter = ['bumen', 'mail']
    actions = None
    aggregate_fields = {"bumen": "sum", 'datatime': "sum"}


'''
维修数据
'''
class HardRepairAdmin(object):
    list_display = (
        'bxdate', 'bumen', 'sqr', 'guzhang', 'sbname', 'sbpinpai', 'xinghao', 'sn', 'code', 'bx', 'gzmiaoshu', 'wxzt',
        'jdyj', 'xfdate')
    list_display_links = ('sbname')

    list_filter = ['bxdate', 'guzhang', 'sbname', 'sbpinpai', 'bx', 'gzmiaoshu', 'wxzt', 'jdyj', 'xfdate', 'wxje']
    actions = None


'''
机房巡查
'''


class RoomPatrolAdmin(object):
    list_display = ('jifang', 'datatime', 'xcname', 'wendu', 'shidu', 'ups', 'sim', 'beizhu')
    list_display_links = ('jifang')

    list_filter = ['jifang', 'datatime', 'xcname', 'wendu', 'shidu', 'ups', 'sim', 'beizhu']
    actions = None


'''
网络故障记录
'''


class NetwokFaultAdmin(object):
    list_display = ('cbmc', 'qstime', 'jztime', 'cxtime', 'gzms', 'gzyy', 'gzjjbm', 'gzjjr', 'jjbf', 'bgr', 'beizhu')
    list_display_links = ('cbmc', 'gzyy')

    list_filter = ['cbmc', 'qstime', 'jztime', 'cxtime', 'gzms', 'gzyy', 'gzjjbm', 'gzjjr', 'jjbf', 'bgr', 'beizhu']
    actions = None

# class WeeklyAdmin(object):
# list_display = ('fujian')
# list_display_links = ('fujian')
#  list_filter = ['fujian']
#   actions = None


# xadmin.site.register(Weekly, WeeklyAdmin)

xadmin.site.register(NetwokFault, NetwokFaultAdmin)
xadmin.site.register(RoomPatrol, RoomPatrolAdmin)
xadmin.site.register(HardRepair, HardRepairAdmin)
xadmin.site.register(NetworkAccess, NetworkAccessAdmin)
